<?php
class SetDefault extends Action {
	/* (non-PHPdoc)
	 * @see Action::execute()
	 */
	public function execute($params) {
		check_login ( ADMIN_LOGIN_PAGE );
		$tid = irqst ( 'tid' );
		$data ['success'] = true;
		if (empty ( $tid )) {
			$data ['success'] = false;
			$data ['msg'] = '非法的主题编号';
		} else {
			$tM = new WebThemeModel ();
			$rst = $tM->setDefault ( $tid );
			if (! $rst) {
				$data ['success'] = false;
				$data ['msg'] = '设置默认主题时发生了错误:' . $tM->last_error_msg ();
			}
		}
		return new JsonView ( $data );
	}
}